/**
 * 
 */
package JUnitTests;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import Framework.*;
/**
 * @author Pierre-Olivier
 *
 */
public class TestDiceCollection {

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception 
	{
		testConstructor();
		testAddAndNext();
		testGetObject();
		testHasNext();
		testGet();
	}

	/**
	 * Test method for {@link Framework.DiceCollection#DiceCollection(java.lang.Object)}.
	 */
	@Test
	public final void testConstructor() 
	{
		DiceCollection dc = new DiceCollection(new Dice());
		
		if (dc == null)
			fail("Roll or GetResult failed");
	}

	/**
	 * Test method for {@link Framework.DiceCollection#DiceCollection(java.lang.Object)}.
	 */
	@Test
	public final void testAddAndNext() 
	{
		DiceCollection dc = new DiceCollection(new Dice());
		
		dc.add(new DiceCollection(new Dice()));
		
		if (dc == null || dc.next() == null)
			fail("Add to collection or function \"next\" failed");
	}

	/**
	 * Test method for {@link Framework.DiceCollection#DiceCollection(java.lang.Object)}.
	 */
	@Test
	public final void testGetObject() 
	{
		DiceCollection dc = new DiceCollection(new Dice());
		
		if (dc.getObject() == null)
			fail("Add to collection failed");
	}

	/**
	 * Test method for {@link Framework.DiceCollection#DiceCollection(java.lang.Object)}.
	 */
	@Test
	public final void testHasNext() 
	{
		DiceCollection dc = new DiceCollection(new Dice());
		
		dc.add(new DiceCollection(new Dice()));
		
		if (dc.hasNext())
			fail("\"HasNext\" failed");
	}

	/**
	 * Test method for {@link Framework.DiceCollection#DiceCollection(java.lang.Object)}.
	 */
	@Test
	public final void testGet() 
	{
		DiceCollection dc = new DiceCollection(new Dice());
		
		dc.add(new DiceCollection(new Dice()));
		
		if (dc.get(0) == null || dc.get(1) == null)
			fail("\"Get\" failed");
	}
	
	
}
